package com.ruoyi.track.service.impl;

import java.security.Security;
import java.util.List;

import com.ruoyi.common.core.context.SecurityContextHolder;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.student.api.RemoteStudentService;
import com.ruoyi.student.api.domain.SysStudent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.track.mapper.SysTrackMapper;
import com.ruoyi.track.domain.SysTrack;
import com.ruoyi.track.service.ISysTrackService;

/**
 * 学生跟踪Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-25
 */
@Service
public class SysTrackServiceImpl implements ISysTrackService 
{
    @Autowired
    private SysTrackMapper sysTrackMapper;
    @Autowired
    private RemoteStudentService remoteStudentService;
    /**
     * 查询学生跟踪
     * 
     * @param id 学生跟踪主键
     * @return 学生跟踪
     */
    @Override
    public SysTrack selectSysTrackById(Long id)
    {
        return sysTrackMapper.selectSysTrackById(id);
    }

    /**
     * 查询学生跟踪列表
     * 
     * @param sysTrack 学生跟踪
     * @return 学生跟踪
     */
    @Override
    public List<SysTrack> selectSysTrackList(SysTrack sysTrack)
    {
        return sysTrackMapper.selectSysTrackList(sysTrack);
    }

    /**
     * 新增学生跟踪
     * 
     * @param sysTrack 学生跟踪
     * @return 结果
     */
    @Override
    public int insertSysTrack(SysTrack sysTrack)
    {
        sysTrack.setTrackMan(SecurityContextHolder.getUserName());
        return sysTrackMapper.insertSysTrack(sysTrack);
    }

    /**
     * 修改学生跟踪
     * 
     * @param sysTrack 学生跟踪
     * @return 结果
     */
    @Override
    public int updateSysTrack(SysTrack sysTrack)
    {
        return sysTrackMapper.updateSysTrack(sysTrack);
    }

    /**
     * 批量删除学生跟踪
     * 
     * @param ids 需要删除的学生跟踪主键
     * @return 结果
     */
    @Override
    public int deleteSysTrackByIds(Long[] ids)
    {
        return sysTrackMapper.deleteSysTrackByIds(ids);
    }

    /**
     * 删除学生跟踪信息
     * 
     * @param id 学生跟踪主键
     * @return 结果
     */
    @Override
    public int deleteSysTrackById(Long id)
    {
        return sysTrackMapper.deleteSysTrackById(id);
    }

    /**
     * 根据班级id查询学生所有
     * @param classId
     */
    @Override
    public TableDataInfo getClassIdByStudent(Long classId) {
        //远程调用
        TableDataInfo studentByClassId = remoteStudentService.getStudentByClassId(classId);
        return studentByClassId;
    }
}
